package mywebapps.security;

import org.springframework.security.GrantedAuthority;
import org.springframework.security.userdetails.UserDetails;

public class UserDetailsImpl implements UserDetails
{
    private static final long serialVersionUID = -762736504563637547L;

    private String username;
    private String password;
    private boolean accountNonExpired;
    private boolean accountNonLocked;
    private boolean credentialsNonExpired;
    private boolean enabled;
    private GrantedAuthority[] authorities;
    
    @Override
    public GrantedAuthority[] getAuthorities()
    {
//        return new GrantedAuthority[] { new GrantedAuthorityImpl("ROLE_USER")};
        return authorities;
    }
    
    public void setAuthorities(GrantedAuthority[] authorities) 
    {
        this.authorities = authorities;
    }

    @Override
    public String getPassword()
    {
        return password;
    }

    @Override
    public String getUsername()
    {
        return username;
    }

    @Override
    public boolean isAccountNonExpired()
    {
        return accountNonExpired;
    }

    @Override
    public boolean isAccountNonLocked()
    {
        return accountNonLocked;
    }

    @Override
    public boolean isCredentialsNonExpired()
    {
        return credentialsNonExpired;
    }

    @Override
    public boolean isEnabled()
    {
        return enabled;
    }

    public void setUsername(String username)
    {
        this.username = username;
    }

    public void setPassword(String password)
    {
        this.password = password;
    }

    public void setAccountNonExpired(boolean accountNonExpired)
    {
        this.accountNonExpired = accountNonExpired;
    }

    public void setAccountNonLocked(boolean accountNonLocked)
    {
        this.accountNonLocked = accountNonLocked;
    }

    public void setCredentialsNonExpired(boolean credentialsNonExpired)
    {
        this.credentialsNonExpired = credentialsNonExpired;
    }

    public void setEnabled(boolean enabled)
    {
        this.enabled = enabled;
    }
}
